public class Item{
  float x,y,size;
  int prob=100;
  String nome;
  color cor;
  Ball bola;
  boolean pego;
  PFont font;  
  
  Item(String nome, color cor,Ball bola){
    font = loadFont("fontes//Arial-BoldMT-48.vlw"); 
    
    this.nome=nome;
    this.cor=cor;
    size=20;
    x=y=200;
    this.bola=bola;
  }
  
  void start(){
    rectMode(RADIUS);
    fill(cor,150);
    stroke(0);
    rect(x,y,size,size);
    textFont(font,15);
    fill(0,0,0);
    text(nome,x+size/2,y+size-size/3,size,size);
    //x=mouseX;
    //y=mouseY;
    //if(random(prob)==1)
    if(mousePressed)  
      aleatorio();
    pega();  
  }
  
  void aleatorio(){
    x=random(50, width-50);
    y=random(50, height-50);
  }
  
  void pega(){
    if(Math.abs(bola.x-x)<bola.size+size && Math.abs(bola.y-y)<bola.size+size){
      x=y=-25;
      pego=true;
    }
  }
}
